home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
298_01
/
curses.doc
< prev
next >
Wrap
Text File
|
1988-08-15
|
58KB
|
1,473 lines
The PC Curses Library
(C) Copyright 1987,1988 Jeffrey S. Dean. All Rights Reserved.
PC CURSES LICENSE AGREEMENT
The PC Curses Library Package is a copyrighted software
package that is being distributed as shareware. It is NOT in
the public domain. By using or distributing this package, you
agree to the conditions presented below:
(1) You may use the PC Curses Library for your own personal
use; if you find it useful, you are requested to pay a $20
registration fee. If you are using PC Curses in a
commercial, professional, or governmental organization, you
are granted a limited license, valid for thirty days, to use
this package for evaluation purposes only; if you continue to
use this package, you must pay the registration fee. The
registration fee entitles you to use the PC Curses library on
one machine. It also includes one free upgrade.
(2) Source code is available to registered users only.
Source code is also copyrighted, and may NOT be freely copied
or distributed. The price of the source distribution is $20;
in addition to the source modules, it include makefiles (as
well as a version of the "make" program and other utilities).
(3) The PC Curses Library (except source) may be freely
distributed and copied inside the U.S.; however, you may not
charge anything for the distribution. The distribution must
include everything in the original distribution, including
this agreement. You may not distribute this system with any
modifications (this includes documentation as well as
programs); additions must be placed in separate files and
must be clearly marked as such.
(4) If any part of the PC Curses Library is used in a
program, system, or service that is distributed to machines
other than the one originally licensed, there is a nominal
fee (in addition to the registration fee) and a simple
licensing agreement that must be completed. This fee may be
waived if the program or system is distributed as shareware
or by a non-profit organization (but the licensing agreement
must still be completed). There are no royalties.
(5) DISCLAIMER OF WARRANTY: THE PC CURSES PACKAGE IS SOLD "AS
IS" AND WITHOUT ANY WARRANTIES, EXPRESS OR IMPLIED, AS TO
PERFORMANCE OR MERCHANTABILITY. BECAUSE OF THE DIVERSITY OF
CONDITIONS UNDER WHICH THIS PACKAGE MAY BE USED, NO WARRANTY
OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. THE USER IS
ADVISED TO TEST THE PACKAGE THOROUGHLY BEFORE RELYING ON IT.
THE USER MUST ASSUME FULL RISK AS TO THE RESULTS AND
PERFORMANCE OF USING THE PACKAGE. ANY LIABILITY OF THE
AUTHOR OR DISTRIBUTOR WILL BE LIMITED EXCLUSIVELY TO PRODUCT
REPLACEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DAMAGES ARISING FROM THE USE OR INABILITY TO USE THIS
PACKAGE.
Ordering PC Curses
PC Curses complete evaluation system . . . $5
PC Curses registration . . . . . . . . . . $20
The following items are available only to registered users:
PC Curses source code . . . . . . . . . . . $20
PC Curses redistribution license . . . . . $20
When ordering source code, please specify the compiler
(Microsoft or Turbo) and version you are using.
All payments must be in U.S. dollars. For orders outside the
U.S., please add an extra $15 per order. (The evaluation
system is not available outside the U.S.)
Send orders and other correspondence to:
Jeff Dean
710 Chimalus
Palo Alto, CA 94306
Table of Contents
Introduction
Programmers Notes
Standard Curses Functions
Terminfo Curses Functions
Even Newer Curses Functions
Special PC Curses Functions
Special PC-Specific Functions
Tracing in PC Curses
What's Different
Version History
INTRODUCTION
PC Curses is a C Library designed to provide compatibility
with the Unix curses package. It was written for applications
running on IBM PC compatible computers developed under
Microsoft C or Turbo C.
The Unix curses package was originally developed at the
University of California at Berkeley as a screen management
and windowing package, providing various tools for creating
and manipulating windows. Its key strength is the ability to
deal with many different types of terminals at any line speed
in a semi-optimized fashion. For many years, it was the only
generally available package that provided windowing
capabilities in the Unix environment.
PC Curses was produced to aid in porting programs from MS-DOS
to Unix, though it is also useful in writing MS-DOS software
that may need to be ported to Unix. The PC environment is
drastically different from Unix, so while this package is
meant to be functionally similar to the Unix one, there are a
few small differences externally (but many differences
internally).
This package is much simpler that the Unix version. Because
of the nature of the PC environment, there is no need for
anything like cursor motion optimization. Because of the
high screen bandwidth, little effort is spent trying to
optimize screen output. Because the PC has features not
always available in other environments, additional routines
(not in the original curses package) are provided.
The PC Curses code was developed independently, without
reference to the Unix source code. This documentation is
based on experience with the curses package, on Ken Arnold's
paper "Screen Updating and Cursor Movement Optimization: A
Library Package," and on the Unix System V curses
documentation.
Arnold's paper (or the newer System V documentation) should
be considered required reading in order to understand how
this system works. The documentation included here
summarizes some of the relevant information, and points out
differences between the Unix version and the PC version.
Note that there are two major versions of curses. The
original, produced some time ago at UC Berkeley, used the
termcap database. More recently, the termcap (or termlib)
database has been recast into the terminfo database, for
efficiency and extensions. A new version of curses was
written to take advantage of this system. PC Curses derives
primarily from the earlier version, with some features of the
later version added. In this documentation, the newer
version is referred to as "terminfo curses"; elsewhere, you
may hear it referred to as "System V curses."
Please let us know what you think of this package; any
feedback, positive or negative, is appreciated. If you have
any suggestions, problems, or code you would like to see
included in the distribution, please contact us. We are
planning to continue to improve and expand this package,
adding subroutines, utilities, and anything else that would
prove generally useful to curses programmers.
PROGRAMMERS NOTES
The basic "unit" of manipulation in curses is a window.
Windows are dynamically allocated structures, and are passed
around by pointer. Windows represent a rectangular region on
the terminal screen.
The windows are, in a sense, buffered. There are a variety
of operations for writing windows, but no changes visibly
take place until a wrefresh() command is issued. At this
point, all the changes are written to the physical screen.
There are two special windows in the system, created on
startup. One is the current screen (curscr), and represents
the information that is presently on the screen. The other
is the standard sc